import camera, time, jpeg
camera.init()
time.sleep(5)
img = camera.capture()  # bytes
camera.deinit()
with open("capture.jpg", "wb") as f:
    f.write(img)

print("JPEG encoding completed")